<template>
  <div>
    <tableComponents
      :pagination="{ currentPage, pageSize, total: list.all_num }"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      @sendUserSearch="getUserSearch"
      :searchData="userSearchData"
      @toAdd="add"
      exportUrl="/api/admin/export/excel_out_user"
      :toUp="toUpName"
      :down="down"
      :isShow="visi"
    >
      <template v-slot:headRight>
        <div class="fx head-right-icon">
          <p @click="clear_ewm_all">
            <i class="el-icon-close"></i>&nbsp;&nbsp;清空二维码
          </p>
        </div>
      </template>
      <template v-slot:table>
        <el-table
          ref="multipleTable"
          :data="list.data"
          v-loading="loading"
          stripe
          header-row-class-name="head_color"
          tooltip-effect="dark"
          style="width: 99.8%"
          @selection-change="handleSelectionChange"
        >
          <el-table-column
            type="selection"
            class="tc"
            width="35"
          ></el-table-column>

          <el-table-column label="会员" min-width="80" align="center">
            <template slot-scope="scope">
              <div class="tc">
                <img
                  style="width: 50px; height: 50px"
                  :src="imgError(scope.row.avatar)"
                  class="user_img"
                />
                <span>{{ scope.row.rating_cn }}</span>
                <br />
              </div>
            </template>
          </el-table-column>

          <el-table-column label="会员信息" min-width="160">
            <template slot-scope="scope">
              <div class="user_table">
                <span>用户昵称：</span>
                <small>{{ scope.row.nickname || "----" }}</small>
                <br />
                <span>会员账号：</span>
                <small>{{ scope.row.username }}</small>
                <el-tag
                  effect="dark"
                  type
                  size="mini"
                  color="#f56c6c"
                  style="margin-left: 10px"
                >
                  <small
                    id="tjm_btn"
                    style="color: white; font-weight: normal; cursor: pointer"
                    @click="copy_tjm($event)"
                    >点击复制</small
                  >
                </el-tag>
                <br />
                <span>推荐人：</span>
                <small>{{ scope.row.tid_cn || "----" }}</small>
                <!-- <span
                  v-if="scope.row.tid_cn != ''"
                  @click="toUp(scope.row.username)"
                  class="find_btn"
                >查询上级</span>-->
                <br />

                <span>手机号：</span>
                <small>{{ scope.row.tel || "----" }}</small>
                <br />

                <span v-if="is_open.xnbkj && is_open.xnbkj.is_open == 1"
                  >矿机等级：</span
                >
                <small v-if="is_open.xnbkj && is_open.xnbkj.is_open == 1">
                  {{ scope.row.coin_rating_cn }}
                </small>
                <br v-if="is_open.xnbkj && is_open.xnbkj.is_open == 1" />

                <span>注册时间：</span>
                <small>{{ scope.row.created_time | getTimeFormat }}</small>
                <br />

                <div
                  v-if="
                    scope.row.vip_time &&
                    scope.row.vip_time > 0 &&
                    Number(scope.row.vip_time) >
                      Number(JSON.stringify(new Date().getTime()).substr(0, 10))
                  "
                >
                  <span>到期时间：</span>
                  <small>{{ scope.row.vip_time | getTimeFormat }}</small>
                  <br />
                </div>
                <span>备注：</span>
                <small>{{ scope.row.admin_remark }}</small>
                <br />
              </div>
            </template>
          </el-table-column>
          <el-table-column label="资金" min-width="120">
            <template slot-scope="scope">
              <div
                v-for="(item, x) in scope.row.reward_ar[1]"
                class="user_table"
                :key="x"
              >
                <span>{{ item.title }}：</span>
                <small>{{ item.value }}</small>
              </div>
            </template>
          </el-table-column>
          <el-table-column
            label="虚拟币"
            min-width="150"
            v-if="is_open.xnbkj && is_open.xnbkj.is_open != 0"
          >
            <template slot-scope="scope">
              <div
                v-show="is_open.xnbkj && is_open.xnbkj.is_open == 1"
                v-for="(item, i) in scope.row.reward_ar[0]"
                class="user_table"
                :key="i"
              >
                <span>{{ item.title }}：</span>
                <small>{{ item.value }}</small>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="下级会员数" min-width="80">
            <template slot-scope="scope">
              <div class="user_table">
                <span v-if="is_open.xnbkj && is_open.xnbkj.is_open != 0" style>
                  直推/会员/虚拟币:&nbsp;&nbsp;
                  <small>
                    {{ scope.row.ynumber || 0 }}/{{ scope.row.yvip || 0 }}/{{
                      scope.row.coin_yvip || 0
                    }}
                  </small>

                  <!-- <span
                    v-if="scope.row.ynumber != 0"
                    @click="toUp(scope.row.username, 'down', scope.row.ynumber)"
                    class="find_btn"
                  >查询下级</span>-->
                </span>
                <span v-else style>
                  直推/会员:&nbsp;
                  <small>
                    {{ scope.row.ynumber || 0 }}/{{ scope.row.yvip || 0 }}
                  </small>
                  <!-- <span
                    v-if="scope.row.ynumber != 0"
                    @click="toUp(scope.row.username, 'down', scope.row.ynumber)"
                    class="find_btn"
                  >查询下级</span>-->
                </span>
                <br />
                <span>商城累计消费:&nbsp;&nbsp;</span>
                <small>{{ scope.row.buy | toFixedNum }}</small>
                <br />
                <span v-if="is_open.xnbkj && is_open.xnbkj.is_open != 0"
                  >虚拟币累计消费:&nbsp;&nbsp;</span
                >
                <small v-if="is_open.xnbkj && is_open.xnbkj.is_open != 0">
                  {{ scope.row.coin_buy || 0 }}
                </small>
                <br />
                <span v-if="is_open.xnbkj && is_open.xnbkj.is_open != 0"
                  >虚拟币累计佣金:&nbsp;&nbsp;</span
                >
                <small v-if="is_open.xnbkj && is_open.xnbkj.is_open != 0">
                  {{ scope.row.sum_coin || 0 }}
                </small>
                <div v-for="(item, i) in scope.row.made" :key="i">
                  <span>{{ item.title }}:&nbsp;&nbsp;</span>
                  <small>{{ item.value }}</small>
                </div>

                <span v-if="is_open.dapp && is_open.dapp.is_open == 1"
                  >dapp累计入单：</span
                >
                <small v-if="is_open.dapp && is_open.dapp.is_open == 1">
                  {{ scope.row.dapp_rating || "---" }}
                </small>
                <br v-if="is_open.dapp && is_open.dapp.is_open == 1" />
              </div>
            </template>
          </el-table-column>

          <el-table-column label="操作" min-width="80">
            <template slot-scope="scope">
              <el-button
                size="mini"
                @click="addMineClient(scope.row.id)"
                type="success"
                >拉取</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </template>
      <template v-slot:footerLeft>
        <a
          class="aBtn aBtn_1 aBtn_lan2"
          v-show="addClientId"
          @click="addMoreClient()"
          >拉取用户</a
        >
      </template>
    </tableComponents>
  </div>
</template>
<script>
import CollectionsEdit from "@/components/user/collections_edit.vue"; //收款信息
import UserEdit from "@/components/user/user_edit.vue"; //编辑会员
import UserReal from "@/components/user/user_real.vue"; //编辑会员
import RatingEdit from "@/components/user/user_rating.vue"; //设等级
import RechargeEdit from "@/components/user/user_recharge.vue"; //充值
import ChangetidEdit from "@/components/user/user_changetid.vue"; //修改推荐人
import LetterEdit from "@/components/user/user_letter.vue"; //发送站内信
import WxewmEdit from "@/components/user/user_wxewm.vue"; //微信二维码
import WyewmEdit from "@/components/user/user_wyewm.vue"; //网页二维码

import XcyewmEdit from "@/components/user/user_xcyewm.vue"; //网页二维码

import SupplierEdit from "@/components/user/user_supplier.vue"; //编辑与加入供应商
import cityCascader from "@/components/currency/cityCascader/cityCascader";
import userRelationPhone from "@/components/user/userRelationPhone/userRelationPhone";
import serviceAdd from "@/components/user/service/servideAdd";
import userReset from "@/components/user/user_reset";
import { userSearchData } from "@/assets/js/searchData/searchData"; //引入搜索的数据
export default {
  data() {
    return {
      collectionsel: "",
      userSearchData: userSearchData,
      reset_id: "",
      show_reset: false,
      open_btn: [],
      toUpName: "",
      down: "",
      showAgent: false,
      showAddPhoneDio: false,
      row: {},
      agent: {
        is_agent: "0",
        agent_province: "",
        agent_city: "",
        agent_area: "",
        agent_town: "",
      },
      options: [],
      optionProps: {
        value: "y",
        label: "t",
        children: "z",
        checkStrictly: true,
      },
      selectedOptions: [],
      is_open: this.$store.state.plugin || {},
      show: false,
      show_user: false,
      show_real: false,
      show_rating: false,
      show_recharge: false,
      show_changetid: false,
      show_letter: false,
      show_wxewm: false,
      show_wyewm: false,
      show_supplier: false,
      list: [],
      allPage: 0,
      allNum: 0,
      pageSize: 10,
      currentPage: 1,
      editId: "",
      editUser: "",
      realname: "",
      shoptitle: "",
      isSupplier: "",
      multipleSelection: "",
      arr: [],
      visible: false,
      clickNum: 0,
      updataIndex: "",
      clickNum_user: 0,
      clickNum_rating: 0,
      clickNum_recharge: 0,
      clickNum_changetid: 0,
      clickNum_letter: 0,
      clickNum_wxewm: 0,
      clickNum_wyewm: 0,
      clickNum_xcyewm: 0,
      clickNum_supplier: 0,
      searchAll: {},
      value: "",
      addvisible: false,
      show_xcyewm: false,
      data: {
        // username: "",
        quhao: "86",
        tel: "",
        password: "",
        pay_password: "",
      },
      loading: false,
      dataYZ: {
        // username: [
        //     { required: true, message: "请输入会员账号", trigger: "blur" }
        // ],
        password: [
          { required: true, message: "请输入登录密码", trigger: "blur" },
        ],
      },
      visi: true,
      showCity: true,
      service: {
        id: "",
        username: "",
        types: 1,
      },
      showService: false,
    };
  },
  components: {
    CollectionsEdit,
    UserEdit,
    RatingEdit,
    RechargeEdit,
    ChangetidEdit,
    LetterEdit,
    WxewmEdit,
    WyewmEdit,
    SupplierEdit,
    cityCascader,
    userRelationPhone,
    serviceAdd,
    UserReal,
    XcyewmEdit,
    userReset,
    addClientId: "",
  },
  mounted() {
    this.addClientId = this.$route.query.id ? this.$route.query.id : "";
    this.getp_public_user();
  },
  methods: {
    addMineClient(id) {
      //
      let params = {};
      params.id = this.addClientId;
      params.id_str = id;
      this.$api.getCrm.addClient(params).then((res) => {
        console.log(res);
        if (res.data.code == 200) {
          this.$swal("拉取成功！", "您拉取了这个员工。", "success");
          this.getp_public_user();
          return;
        }
        this.$swal("拉取失败！", res.data.result, "error");
      });
    },
    addMoreClient() {
      let id_str = "";
      this.multipleSelection.map((item) => {
        id_str += item.id + "@";
      });
      id_str = id_str.slice(0, id_str.length - 1);
      let params = {};
      params.id = this.addClientId;
      params.id_str = id_str;
      this.$api.getCrm.addClient(params).then((res) => {
        if (res.data.code == 200) {
          this.$swal("拉取成功！", "您拉取了这些员工。", "success");
          this.getPublicUser();
          return;
        }
        this.$swal("拉取失败！", res.data.code_desc, "success");
      });
    },
    getp_public_user(obj = {}) {
      // obj ? obj : { staff_id: 0 };
      obj.is_staff = 1;
      this.$api.getCrm.see_public_user(obj).then((res) => {
        if (res.data.code == 200) {
          this.list = res.data.result;
        }
      });
    },
    toObj(obj, str) {
      obj = obj || {};
      obj.commandStr = str;
      return JSON.parse(JSON.stringify(obj));
    },
    handleCommand(command) {
      var str = command.commandStr;
      switch (str) {
        case "详情":
          this.getUserInfo(command.id);
          break;
        case "实名认证":
          this.showreal_dia(command.id);
          break;
        case "收款信息zfb":
          this.collectionsel = "zfb";
          this.showCollectDialog(command.id);
          break;
        case "收款信息wx":
          this.collectionsel = "wx";
          this.showCollectDialog(command.id);
          break;
        case "收款信息bank":
          this.collectionsel = "bank";
          this.showCollectDialog(command.id);
          break;
        case "编辑":
          this.showEditDialog(command.id);
          break;
        case "删除":
          this.deleteNew(command.id);
          break;
        case "修改推荐人":
          this.showchangetidDialog(command.id, command.username);
          break;
        case "发送客服消息":
          this.checkShowService(command.id, command.username, command.nickname);
          break;
        case "重置二维码":
          this.resetEwm(command.id, command.username);
          break;
        case "微信推广码":
          this.resetWxEwm(command.id, command.username);
          break;
        case "H5推广码":
          this.resetWyEwm(command.id, command.username);
          break;
        case "小程序推广码":
          this.resetXcyEwm(command.id, command.username);
          break;
        case "解除绑定":
          this.reset_btn(command.id);
          break;
        case "重置密码":
          this.resetPassword(command.id, command.username);
          break;
        case "重置支付密码":
          this.resetPayPassword(command.id, command.username);
          break;
        case "账户充减":
          this.showRechargeDialog(command.id, command.username);
          break;
        case "设置等级":
          this.showRatingDialog(command.id);
          break;
        case "设为代理":
          this.editAgent(command);
          break;
        case "设为供应商":
          this.showSupplierDialog(command);
          break;
        case "发送站内信":
          this.showLetterDialog(command.id, command.username, command.nickname);
          break;
        default:
          break;
      }
    },
    rec_success() {
      this.reset_id = "";
      this.show_reset = false;
      this.getNewsAll(this.searchAll);
    },
    reset_btn(id) {
      this.reset_id = id;
      this.show_reset = true;
    },
    get_admin() {
      var params = {};
      params.id = localStorage.getItem("adminuid");
      this.$api.getUser.getHeadUserInfo(params).then((res) => {
        if (res.data.code == 200) {
          var arr = [];
          if (
            res.data.result.role_con_user != "" &&
            res.data.result.role_con_user
          ) {
            arr = res.data.result.role_con_user.split("@");
            arr = arr.filter((item) => {
              return item != "";
            });
            this.open_btn = arr;
          } else {
            this.open_btn = [
              "详情",
              "编辑",
              "删除",
              "实名认证",
              "收款信息",
              "设等级",
              "账户充减",
              "修改推荐人",
              "发送客服消息",
              "重置密码",
              "重置支付密码",
              "重置二维码",
              "微信推广码",
              "H5推广码",
              "小程序二维码",
              "解除绑定",
            ];
            if (this.is_open.gbfx && this.is_open.gbfx.is_open == 1) {
              this.open_btn.push("代理商");
            }
            if (this.is_open.shbxt && this.is_open.shbxt.is_open == 1) {
              this.open_btn.push("供应商");
            }
          }
        }
      });
    },
    // toUp(tid, st, index) {
    //   console.log(tid);
    //   if (tid) {
    //     if (st == "down") {
    //       if (index == 0) {
    //         this.$swal("无下级级推荐人", "", "error");
    //       } else {
    //         this.getUserSearch({ t_username: tid });
    //         this.down = tid;
    //       }
    //     } else {
    //       this.getUserSearch({ u_username: tid });
    //       this.toUpName = tid;
    //     }
    //   } else {
    //     this.$swal("无上级推荐人", "", "error");
    //   }
    // },
    export_user() {
      this.$fnc.postExcelFile({}, "/api/admin/export/excel_out_user");
    },
    showreal_dia(id) {
      this.show_real = true;
      this.editId = id;
      this.clickNum_user++;
    },
    getOpenThis(bool) {
      if (bool) {
        this.getNewsAll(this.searchAll);
      } else {
        this.showService = false;
      }
    },
    checkShowService(id, username, nickname) {
      this.showService = true;
      this.service.id = id;
      this.service.username = username;
      this.service.nickname = nickname;
    },
    showAddPhone(id) {},
    changeRadio() {
      this.showCity = false;
      setTimeout(() => {
        this.showCity = true;
      }, 500);
    },
    clear_ewm_all() {
      this.$swal({
        title: "您确定要清空全部二维码吗",
        text: "清空后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要删除",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          this.$api.getUser.clear_all_ewm({}).then((res) => {
            if (res.data.code == 200) {
              this.getNewsAll();
            } else {
              this.$swal(res.data.result, "error");
            }
          });
        }
      });
    },
    subAgent() {
      this.showAgent = false;
      var params = this.agent || {};
      this.$api.getUser.editAgent(params).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("操作成功");
          this.getNewsAll(this.searchAll);
        }
      });
    },
    handleChange(value) {
      this.agent.agent_province = "";
      this.agent.agent_city = "";
      this.agent.agent_area = "";
      this.agent.agent_town = "";
      if (value) {
        for (var i = 0; i < value.length; i++) {
          if (i == 0) this.agent.agent_province = value[i];
          if (i == 1) this.agent.agent_city = value[i];
          if (i == 2) this.agent.agent_area = value[i];
          if (i == 3) this.agent.agent_town = value[i];
        }
      }
    },
    editAgent(item) {
      this.showAgent = true;
      this.agent.id = item.id;
      this.agent.is_agent = item.is_agent;
      this.selectedOptions = [
        item.agent_province,
        item.agent_city,
        item.agent_area,
        item.agent_town,
      ];
    },
    copy_tjm($event) {
      var dom = $event.currentTarget.parentElement.previousElementSibling;
      var span = dom.innerText;
      var oInput = document.createElement("input");
      oInput.value = span;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand("Copy");
      oInput.className = "oInput";
      oInput.style.display = "none";
      this.$fnc.alertSuccess("复制成功");
    },

    addUpdate(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.addvisible = false;
          var params = {};
          params = this.data;
          this.$api.getUser.addUser(params).then((res) => {
            if (res.data.code == 200) {
              this.$fnc.alertSuccess({ text: "添加成功" });
              this.getNewsAll(this.searchAll);
            } else {
              this.$fnc.alertError(res.data.result);
            }
          });
        }
      });
    },
    add() {
      this.addvisible = true;
    },
    isHasImg(pathImg) {
      var ImgObj = new Image();
      ImgObj.src = pathImg;
      if (ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0)) {
        return true;
      } else {
        return false;
      }
    },
    getUserSearch(obj) {
      obj.is_staff = 1;
      this.searchAll = obj;
      this.$router.push(this.$route.path + "?page=" + 1);
      this.getNewsAll(obj);
    },
    getUserInfo(id, cate_id, ti) {
      let routeData = this.$router.resolve({
        path: "/index/user/user_info",
        query: { id: id, cate_id: cate_id, title: ti },
      });
      window.open(routeData.href, "_blank");
    },
    imgError(item) {
      if (!item) {
        return require("../../assets/img/default_head.png");
      }
      if (item.indexOf("http") >= 0) {
        return item;
      } else if (item.indexOf("api") >= 0) {
        return item;
      } else {
        return "/api/" + item;
      }
    },
    getNewsAll(data) {
      // this.loading = true;
      var params = {};
      data = data || {};
      params = data;
      params.is_staff = 1;
      for (var i in params) {
        if (params[i] == undefined) {
          params[i] = "";
        }
      }
      this.$api.getCrm.see_public_user(params).then((res) => {
        if (res.data.code == 200 && res.data.status == 1) {
          this.list = res.data.result;
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
        this.loading = false;
      });
    },
    handleSizeChange(val) {
      var params = this.searchAll;
      params.page = "";
      params.page_size = val;
      params.is_staff = 1;
      this.getNewsAll(params);
      this.pageSize = val;
      // console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      this.$router.push(this.$route.path + "?page=" + val);
    },
    handleSwitch(val, id) {
      //审核
      var params = {};
      params["id"] = id;
      val == true ? (params["show"] = 1) : (params["show"] = 0);
      this.$api.getUser.userlock(params).then((res) => {
        // this.getNewsAll();
      });
    },
    handleSelectionChange(val) {
      //多选框赋值
      this.multipleSelection = val;
    },
    delSelection() {
      //删除
      this.$swal({
        title: "您确定要删除选中信息吗",
        text: "删除后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要删除",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var str = "";
          for (var i in this.multipleSelection) {
            str += this.multipleSelection[i].id + "@";
          }
          str = str.slice(0, -1);
          var data = { id_str: str };
          this.$api.getUser.userDel(data).then((res) => {
            if (res.data.code == 200) {
              this.getNewsAll();
            } else {
              this.$swal(res.data.result, "error");
            }
          });
        }
      });
    },
    deleteNew(id) {
      this.$swal({
        title: "您确定要删除这条信息吗",
        text: "删除后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要删除",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var data = { id_str: id };
          this.$api.getUser.userDel(data).then((res) => {
            if (res.data.code == 200) {
              this.$swal("删除成功！", "您已经删除了这条信息。", "success");
              this.getNewsAll();
            } else {
              this.$swal(res.data.result, "error");
            }
          });
        }
      });
    },
    resetPassword(id, username) {
      this.$swal({
        title: "确认后当前会员的密码将会重置",
        text: "请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "确认，我要重置",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var data = { username: username, id: id };
          this.$api.getUser.userResetPassword(data).then((res) => {
            if (res.data.code == 200) {
              this.$swal("新密码为" + res.data.result, "重置成功！", "success");
            } else {
              this.$swal("重置失败！", "出错啦！", "success");
            }
          });
        }
      });
    },
    resetPayPassword(id, username) {
      this.$swal({
        title: "当前会员的支付密码将会重置",
        text: "请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "确认，我要重置",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var data = { username: username, id: id };
          this.$api.getUser.userResetPayPassword(data).then((res) => {
            if (res.data.code == 200) {
              this.$swal(
                "重置支付密码为" + res.data.result,
                "重置成功！",
                "success"
              );
            } else {
              this.$swal("重置失败！", "出错啦！", "success");
            }
          });
        }
      });
    },
    resetEwm(id, username) {
      this.$swal({
        title: "如果您确认后，当前会员的二维码会清空，会员可以重新获取",
        text: "请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "确认，我要重置",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          var data = { username: username, id: id };
          this.$api.getUser.userResetEwm(data).then((res) => {
            if (res.data.code == 200) {
              this.$swal("该会员二维码已清空", "重置成功！", "success");
            } else {
              this.$swal("重置失败！", "出错啦！", "success");
            }
          });
        }
      });
    },
    resetWxEwm(id) {
      this.show_wxewm = true;
      this.editId = id;
      this.clickNum_wxewm++;
    },
    resetWyEwm(id) {
      this.show_wyewm = true;
      this.editId = id;
      this.clickNum_wyewm++;
    },
    resetXcyEwm(id) {
      this.show_xcyewm = true;
      this.editId = id;
      this.clickNum_xcyewm++;
    },
    showCollectDialog(id) {
      this.show = true;
      this.editId = id;
      this.clickNum++;
    },

    showEditDialog(id) {
      this.show_user = true;
      this.editId = id;
      this.clickNum_user++;
    },
    showRatingDialog(id) {
      this.show_rating = true;
      this.editId = id;
      this.clickNum_rating++;
    },
    showRechargeDialog(id, u_name) {
      this.show_recharge = true;
      this.editId = id;
      this.editUser = u_name;
      this.clickNum_recharge++;
    },
    showchangetidDialog(id, u_name) {
      this.show_changetid = true;
      this.editId = id;
      this.editUser = u_name;
      this.clickNum_changetid++;
    },
    showLetterDialog(id, u_name) {
      this.show_letter = true;
      this.editId = id;
      this.editUser = u_name;
      this.clickNum_letter++;
    },
    showSupplierDialog(row) {
      console.log(row);
      this.show_supplier = true;

      this.editId = row.id;
      this.editUser = row.nickname;
      this.shoptitle = row.shop_title;
      this.isSupplier = row.is_supplier;
      this.row = row;
      this.clickNum_supplier++;
    },
    reload() {
      this.getNewsAll(this.searchAll);
    },
  },
  beforeCreate() {},
  deactivated() {
    this.searchAll.tid = "";
  },
  // created() {
  //   this.$api.getIndex.getIndex_limits({}).then((res) => {
  //     if (res.data.code == 200) {
  //       localStorage.setItem("limit", JSON.stringify(res.data.result)); //存入 参数： 1.调用的值 2.所要存入的数据
  //       this.$store.commit("setPlugin", res.data.result);
  //       this.is_open = res.data.result;
  //       this.get_admin();
  //     }
  //   });
  //   if (this.$route.query.rank != undefined) {
  //     var id = this.$route.query.rating;
  //     var data = { rating: id };
  //     this.getUserSearch(data);
  //   } else if (this.$route.query.page == undefined) {
  //     this.getNewsAll();
  //   }
  // },
  watch: {
    $route() {
      var params = this.searchAll;
      params.page = this.$route.query.page || 1;
      params.page_size = this.pageSize;
      this.getNewsAll(params);
      this.currentPage = Number(this.$route.query.page) || 1;
    },
  },
  computed: {},
};
</script>

<style lang="less" scoped>
.find_btn {
  background: #3a8ee6;
  border-color: #3a8ee6;
  font-weight: 400;

  padding: 2px 8px;
  color: #ffffff;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 5px;
}
</style>
